import request from '@/utils/request.js'

const prevUrl = '/apply/'


export default {
  // 查询列表
  list: function(query, pageReq) {
    return request({
      url: `${prevUrl}list`,
      method: 'post',
      data: query,
      params: pageReq
    })
  },
  // 查询详情
  detail: function(id) {
    return request({
      url: `${prevUrl}${id}`,
      method: 'get'
    })
  },
  // 查询详情
  detailRelItems: function(id) {
    return request({
      url: `${prevUrl}relItems/${id}`,
      method: 'get'
    })
  },
  // 保存申请
  save: function(params) {
    return request({
      url: `${prevUrl}save`,
      method: 'post',
      data: params
    })
  },
  // 提交申请
  sub: function(id) {
    return request({
      url: `${prevUrl}sub/${id}`,
      method: 'post'
    })
  },
  // 保存并提交申请
  saveAndSub: function(params) {
    return request({
      url: `${prevUrl}saveAndSub`,
      method: 'post',
      data: params
    })
  },
  del: function (id) {
    return request({
      url: `${prevUrl}${id}`,
      method: 'delete'
    })
  }
}

